package com.michael.auth.rest;

import com.michael.auth.biz.AuthBiz;
import com.michael.auth.request.LoginRequest;
import com.michael.auth.response.LoginResponse;
import com.michael.comm.biz.resp.ObjectRestResp;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/auth")
public class AuthController {
    private AuthBiz authService;

    // Login REST API
    @PostMapping("/login")
    public ObjectRestResp authenticate(@RequestBody LoginRequest loginDto){
        LoginResponse login = authService.login(loginDto);
        return ObjectRestResp.ok(login);
    }
}
